home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / sound / sndblst3.zip / RAWOUT.C < prev    next >
Text File  |  1993-10-25  |  2KB  |  65 lines

  1.  
  2. //------------------------------------------------------------------------------
  3. // Copyright (c) David Welch, 1993
  4. //------------------------------------------------------------------------------
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <conio.h>
  9.  
  10. #include "..\sb.h"
  11.  
  12. unsigned char ca;
  13. unsigned short ra;
  14. unsigned long la;
  15. FILE *fp;
  16. unsigned char gstring[80];
  17. unsigned long dLen;
  18. void main ( int argc, char *argv[] )
  19. {
  20.     if(argc<3)
  21.     {
  22.         printf("filename and/or sample rate not specified\n");
  23.         exit(1);
  24.     }
  25.     if((fp=fopen(argv[1],"rb"))==0)
  26.     {
  27.         printf("Error opening file [%s]\n",argv[1]);
  28.         exit(1);
  29.     }
  30.     printf("FILE: [%s]\n",argv[1]);
  31.     sbsetup();
  32.     fseek(fp,0L,2);
  33.     dLen=ftell(fp);
  34.     fseek(fp,0L,0);
  35.     ra=atoi(argv[2]);
  36.     printf("Samples Per Second %u\n",ra);
  37.     ca=256UL-(1000000UL/ra);
  38.     printf("Time Constant %u\n",ca);
  39.     sbsettc(ca);
  40.     spkon();
  41.     while(dLen)
  42.     {
  43.         if(dLen>65000) la=65000; else la=dLen;
  44.         dLen-=la;
  45.         fread(aligned,1,la,fp);
  46.         sbplay(la);
  47.         printf("%lu Samples\n",la);
  48.         while(dmacount()!=0xFFFF)
  49.         {
  50.             if(kbhit())
  51.             {
  52.                 sbhaltdma();
  53.                 getch();
  54.                 dLen=0;
  55.                 break;
  56.             }
  57.         }
  58.     }
  59.     spkoff();
  60. }
  61. //------------------------------------------------------------------------------
  62. // Copyright (c) David Welch, 1993
  63. //------------------------------------------------------------------------------
  64.  
  65.